<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>My JSP 'currencyInput.jsp' starting page</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<link rel="stylesheet" type="text/css"
			href="<%=request.getContextPath()%>/css/public.css">
		<link rel="stylesheet" type="text/css"
			href="<%=request.getContextPath()%>/css/baseset/moneykind_input.css">
		<script language="JavaScript"
			src="<%=request.getContextPath()%>/js/public.js"></script>
		<script language="JavaScript"
			src="<%=request.getContextPath()%>/js/validate.js"></script>
			
		<script type="text/javascript">
		function validate()
		{	
			var code = document.getElementById("code");
			var currencyName = document.getElementById("currencyName");
			var accountRate = document.getElementById("accountRate");
			//var decimal = document.getElementById("decimal")
			//var isRate = document.getElementById("isRate")
			
			
			//验证币别代码
			if(!isNotNull(code,'币别代码')||!f_check_NumOrLett(code,'币别代码')||!f_check_NumLength(code,'币别代码'))
				return false ;	
			//验证币别名称
			if(!isNotNull(currencyName,'币别名称')||!f_check_ZhOrNumOrLett(currencyName,'币别名称')||!f_check_NumLength(currencyName,'币别名称'))
				return false ;	
			//验证记账汇率
			if(!f_check_float(accountRate,'记账汇率')||!f_check_rate(accountRate,'记账汇率'))
				return false ;
			//验证小数位数
			/*if(!isNotNull(decimal,'小数位数')||!f_check_number(decimal,'小数位数'))
				return false ;*/
			//验证固定汇率
			/*if(!isNotNull(isRate,'是否固定汇率')||!f_check_number(isRate,'是否固定汇率'))
				return false ;
			else{
				var num = parseInt(isRate.value) ;
				if(num!=0&&num!=1){
					alert("是否固定汇率只能为0或1");
					return false ;	
					}		
			}*/
			
		}
		</script>

	</head>

	<body>
		<div id="info_all" style="width: 320px;">
			<div id="info_top">
				币别新增
			</div>
			<div id="newmoneykind" align="center">
				<s:form action="addCurrency.action" theme="simple" id="delrow" onsubmit="return validate()"
					cssStyle="margin-top:0px">
					<div class="moneykindid">
						<table>
							<tr>
								<td>
									币别代码*：
								</td>
								<td>
									<s:textfield name="currencyModel.currencyCode" size="15"
										id="code"></s:textfield>
									<s:hidden name="currencyModel.currencyId" id="currencyId"></s:hidden>
								</td>
							</tr>
							<tr>
								<td>
									币别名称*：
								</td>
								<td>
									<s:textfield name="currencyModel.currencyName" size="15"
										id="currencyName" ></s:textfield>
									<!--  <img src="images/kookup.gif" style="cursor:pointer"  onclick="openWin('currency!openSelect.action','accountbook',750,700,0)">-->
								</td>
							</tr>
							<tr>
								<td>
									记账汇率*：
								</td>
								<td>
									<s:textfield name="currencyModel.accountRate" size="15"
										id="accountRate"></s:textfield>
								</td>
							</tr>
						</table>
						<br>
					</div>

					<div align="left">
						折算方式选择：
					</div>
					<div class="moneykind_convert">
						<s:radio name="currencyModel.discount"
							list="#{'0':'原币&nbsp;X&nbsp;汇率&nbsp;=&nbsp;本位币','1':'原币&nbsp;/&nbsp;汇率&nbsp;=&nbsp;本位币'}"
							value="0"></s:radio>
						&nbsp;
					</div>
					<div align="left">
						汇率方式选择：
					</div>
					<div class="moneykind_rate">

						<s:radio name="currencyModel.rates"
							list="#{'0':'固定汇率','1':'浮动汇率'}" value="0"></s:radio>
					</div>
					<div class="moneykind_decimal">
						金额小数位数：
						<s:select
							list="#{'0':'0','1':'1','2':'2','3':'3','4':'4','5':'5','6':'6'}"
							name="currencyModel.numDecimal"></s:select>
					</div>
					<hr>
					<div style="margin: 0px; text-align: center;">
						<s:submit value="保存" onmouseover="this.className='btnover'"
							onfocus="this.blur()" onmouseout="this.className='btnout'"
							id="btnsize"></s:submit>
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						
					<input type="button" value="返回" onclick="window.history.go(-1)" onfocus="this.blur()" onmouseout="this.className='btnout'"
							id="btnsize">
					</div>
				</s:form>
			</div>
		</div>
		<script type="text/javascript">
	 		getTitle('code','币别');	
		</script>
	</body>
</html>
